package enumandlambda;

/**
 * @author shkstart
 * @create 2022-11-29-12:35
 */
public class ThreadDemoByState {
    public static void main(String[] args) {
        Thread t= new Thread(new Runnable() {
            @Override
            public void run() {

//                拿到当前线程并打印当前线程的状态
                Thread thread = Thread.currentThread();
                System.out.println("线程状态2："+ thread.getState());
            }
        });
//        打印线程的状态
        System.out.println("线程状态："+t.getState());
        t.start();

//        再次打印线程状态
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("线程状态3"+t.getState());
    }
}
